<!DOCTYPE html>
<html>
<meta charset="utf-8" >
<head>
    <title>大CL</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<style>
    *{
        font-family:"Microsoft YaHei"；
    }
    #left{
        position: fixed;
        bottom: 0;
        z-index: 999;
        top: 0px;
        width: 400px;
        overflow-x: hidden;

    }
    #right{
        position: absolute;
        left: 400px;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 998;
        width: auto;
        overflow: hidden;
        overflow-y: auto;
    }

    ::-webkit-scrollbar{
        display:none;
    }
    li{
        line-height: 28px;
    }
    li span{
        margin-left: 295px; 
    }
    #content{
        padding-top: 20px;
        background-color: #EDEDED;
        letter-spacing:4px;
        font-size: 20px;
        word-spacing:80px;
    }
</style>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<body>
<div id="left" >
    <div style="overflow-y: hidden;">
        <ul class="list-group">
            {foreach name="list" item="v"}
                <li >
                    <a id="s{$v.id}" href="javascript:show({$v.id});" data-num="{$v.id}" class="list-group-item" >{$v.title} <br><span >{:substr($v.date,0,10)}</span></a>
                </li>
            {/foreach}
        </ul>
    </div>

</div>
<div id="right" class="col-md-6" >

    <div class="panel panel-default" style="margin-top:10px;">
        <div class="panel-heading">
            <h1 id="title" class="panel-title" style="font-size: 30px">

            </h1>
        </div>
        <div id="content">
           
        </div>
    </div>
</div>
</body>
<script>
    function show(id){
        var title = $('#title');
        var content = $('#content');
        var current_content = $('#s'+id);
        // var table_comment = current_table.attr('data-name');
        content.empty();

        var table_class = localStorage.getItem('table_class');
        if(table_class){
            $('#s'+table_class).removeClass('active');
            localStorage.clear("table_class");
        }
        current_content.addClass('active');
        localStorage.setItem("table_class",id);

        $.ajax({
            url:"/index/index/get_content",
            type:'post',
            async:true,
            data:{id:id},
            success:function(result){
                if(result.errcode == 0){
                    console.log(result.data);
                    title.html('<b>'+result.data.title+'</b><span style="font-size:14px;"><a target="_blank" href="'+result.data.url+'">原文链接</a></span>');
                    content.append(result.data.content);
                }
            }
        });
    }

</script>

<script>
    $(function (){
        var first_a = $("ul li:eq(0) a");
        var id = first_a.attr('data-num');

        first_a.addClass('active');
        show(id);
        localStorage.clear("table_class");
        localStorage.setItem("table_class",id);
    });

</script>
</html>

